/**
 * @description: 文件描述
 * @version: 0.0.1
 * @author: ljr
 * @Date: 2023-09-12 16:35:58
 */
import { Inject, Controller, Get, Query, Body, Post, Headers } from '@midwayjs/core';
import { Context } from '@midwayjs/koa';

import { ProjectService } from '../service/project.service';
import { CreatedProjDTO, UpdatedProjDTO, UpdateProjOrderContactDTO, PageByOrderDTO } from '../dto/project';

import { IdDTO} from "../dto/common"

@Controller('/api/v1/project')
export class PojectController {
  @Inject()
  ctx: Context;
  @Inject()
  ProjectService: ProjectService;

  /**
   * @summary 获取项目列表
   * @description 获取项目列表
   * @router post /api/v1/user/checkToken
   * @request body access_token  *body
   * @response 200 baseResponse 返回结果
   */
  @Get('/getProjLists')
  async getProjLists(): Promise<any> {
    return await this.ProjectService.getProjLists();
  }

  /**
   * @summary 项目列表分页查询
   * @description 项目列表分页查询
   * @router post /api/v1/project/getProjPage
   * @request body pageNum  *body
   * @request body pageSize  *body
   * @request body searchKey  *body
   * @request body orderId  *body
   * @response 200 baseResponse 返回结果
   */
  @Post('/getProjPage')
  async getProjPage(@Body() options: PageByOrderDTO): Promise<any> {
    return await this.ProjectService.getProjPage(options);
  }

  /**
  * @summary 删除项目信息
  * @description 删除项目信息
  * @router post /api/v1/project/delProjInfo
  * @request body id  *body
  * @response 200 baseResponse 返回结果
  */
  @Get('/delProjInfo')
  async delProjInfo(@Query() options: IdDTO): Promise<any> {
    return await this.ProjectService.delProjInfo(options);
  }
  /**
   * @summary 新增项目数据
   * @description 新增项目数据
   * @router post /api/v1/project/createdProj
   * @request body id  *body
   * @response 200 baseResponse 返回结果
   */
  @Post('/createdProj')
  async createdProj(@Body() options: CreatedProjDTO, @Headers() headerObj: any): Promise<any> {
    return await this.ProjectService.createdProj({ ...options, ...headerObj });
  }


  /**
   * @summary 修改项目数据
   * @description 修改项目数据
   * @router post /api/v1/project/updatedProj
   * @request body id  *body
   * @response 200 baseResponse 返回结果
   */
  @Post('/updatedProj')
  async updatedProj(@Body() options: UpdatedProjDTO): Promise<any> {
    return await this.ProjectService.updatedProj(options);
  }


  /**
   * @summary 获取项目详情
   * @description 获取项目详情
   * @router post /api/v1/project/getProjById
   * @request body id  *body
   * @response 200 baseResponse 返回结果
   */
  @Post('/getProjById')
  async getProjById(@Body() options: IdDTO): Promise<any> {
    return await this.ProjectService.getProjById(options);
  }


  /**
   * @summary 更新项目管理订单信息
   * @description 更新项目管理订单信息
   * @router post /api/v1/project/updateProjOrderContact
   * @request body id  *body
   * @response 200 baseResponse 返回结果
   */
  @Post('/updateProjOrderContact')
  async updateProjOrderContact(@Body() options: UpdateProjOrderContactDTO,): Promise<any> {
    return await this.ProjectService.updateProjOrderContact(options);
  }

}